 //==========================================================================
//
//	FILE:	Font.c
//	AUTHOR:	Mike Bonnington & Rob Bateman
//	DATE:	Somewhen last century
//	NOTE:
//
//
//	This file defines a small bitmap font for use in openGL
//
//	USAGE:
//
//	You should call FontInit() upon the initialisation of your application.
//
//	Call the function FontDraw() specifying the text to write, and the 2D
//	screen co-ordinates of where you will be drawing the font.
//
//	Use glColor3f() or glColor4f() to specify the colour of the font to be
//	drawn.
//
//	To cleanup any data allocated by the FontInit() function, call the
//	FontCleanup() function.
//
//==========================================================================

#include "font.h"
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#include <stdio.h>

#include "BinaryNumbers.h"	

//==========================================================================
//
//	definition of a small bitmap font
//
//==========================================================================

const unsigned char g_aFontCharacters[96][12] =
{

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	00	' '

	{b00000000,
	 b00000000,
	 b01000000,
	 b00000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b00000000,
	 b00000000},	//	01	'!'

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b10100000,
	 b10100000,
	 b10100000,
	 b00000000},	//	02	'"'

	{b00000000,
	 b00000000,
	 b01010000,
	 b01010000,
	 b11111100,
	 b00101000,
	 b00101000,
	 b01111110,
	 b00010100,
	 b00010100,
	 b00000000,
	 b00000000},	//	03	'#'

	{b00100000,
	 b00100000,
	 b11110000,
	 b01001000,
	 b01001000,
	 b01110000,
	 b10100000,
	 b10100000,
	 b01111000,
	 b00100000,
	 b00100000,
	 b00000000},	//	04	'$'

	{b00000000,
	 b00000000,
	 b00100010,
	 b00100101,
	 b00010101,
	 b00010010,
	 b01001000,
	 b10101000,
	 b10100100,
	 b01000100,
	 b00000000,
	 b00000000},	//	05	'%'

	{b00000000,
	 b00000000,
	 b01110010,
	 b10001100,
	 b10001000,
	 b10010100,
	 b01100100,
	 b10010000,
	 b10010000,
	 b01100000,
	 b00000000,
	 b00000000},	//	06	'&'

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000},	//	07	'''

	{b00100000,
	 b01000000,
	 b01000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b01000000,
	 b01000000,
	 b00100000,
	 b00000000},	//	08	'('

	{b10000000,
	 b01000000,
	 b01000000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b01000000,
	 b01000000,
	 b10000000,
	 b00000000},	//	09	')'

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00100000,
	 b10101000,
	 b01110000,
	 b10101000,
	 b00100000,
	 b00000000},	//	10	'*'


	{b00000000,
	 b00000000,
	 b00010000,
	 b00010000,
	 b00010000,
	 b11111110,
	 b00010000,
	 b00010000,
	 b00010000,
	 b00000000,
	 b00000000,
	 b00000000},	//	11	'+'

	{b10000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	12	','

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b11100000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	13	'-'

	{b00000000,
	 b00000000,
	 b01000000,
	 b01000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	14	'.'

	{b10000000,
	 b10000000,
	 b10000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00000000},	//	15	'/'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000},	//	16	'0'

	{b00000000,
	 b01110000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b01100000,
	 b00100000,
	 b00000000,
	 b00000000},	//	17	'1'

	{b00000000,
	 b00000000,
	 b11111000,
	 b10000000,
	 b01000000,
	 b00100000,
	 b00010000,
	 b00001000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000},	//	18	'2'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10001000,
	 b00001000,
	 b00001000,
	 b00110000,
	 b00001000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000},	//	19	'3'

	{b00000000,
	 b00000000,
	 b00010000,
	 b00010000,
	 b00010000,
	 b11111000,
	 b10010000,
	 b01010000,
	 b00110000,
	 b00010000,
	 b00000000,
	 b00000000},	//	20	'4'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10001000,
	 b00001000,
	 b00001000,
	 b11110000,
	 b10000000,
	 b10000000,
	 b11111000,
	 b00000000,
	 b00000000},	//	21	'5'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b10000000,
	 b01000000,
	 b00110000,
	 b00000000,
	 b00000000},	//	22	'6'

	{b00000000,
	 b00000000,
	 b01000000,
	 b01000000,
	 b00100000,
	 b00100000,
	 b00010000,
	 b00010000,
	 b00001000,
	 b11111000,
	 b00000000,
	 b00000000},	//	23	'7'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b01110000,
	 b10001000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000},	//	24	'8'

	{b00000000,
	 b00000000,
	 b01100000,
	 b00010000,
	 b00001000,
	 b01111000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000},	//	25	'9'

	{b00000000,
	 b00000000,
	 b01000000,
	 b01000000,
	 b00000000,
	 b00000000,
	 b01000000,
	 b01000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	26 ':'

	{b10000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b00000000,
	 b00000000,
	 b01000000,
	 b01000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	27	';'

	{b00000000,
	 b00000000,
	 b00000010,
	 b00001100,
	 b00110000,
	 b01000000,
	 b00110000,
	 b00001100,
	 b00000010,
	 b00000000,
	 b00000000,
	 b00000000},	//	28	'<'

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b11111110,
	 b00000000,
	 b11111110,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	29	'='

	{b00000000,
	 b00000000,
	 b01000000,
	 b00110000,
	 b00001100,
	 b00000010,
	 b00001100,
	 b00110000,
	 b01000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	30	'>'

	{b00000000,
	 b00000000,
	 b01000000,
	 b00000000,
	 b01000000,
	 b01000000,
	 b00100000,
	 b00010000,
	 b00010000,
	 b11100000,
	 b00000000,
	 b00000000},	//	31	'?'

	{b00000000,
	 b00111000,
	 b01000000,
	 b10011110,
	 b10101001,
	 b10101001,
	 b10101001,
	 b10011001,
	 b01000010,
	 b00111100,
	 b00000000,
	 b00000000},	//	32	'@'

	{b00000000,
	 b00000000,
	 b10000100,
	 b10000100,
	 b10000100,
	 b11111100,
	 b01001000,
	 b01001000,
	 b01001000,
	 b00110000,
	 b00110000,
	 b00000000},	//	33	'A'

	{b00000000,
	 b00000000,
	 b11110000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b00000000,
	 b00000000},	//	34	'B'

	{b00000000,
	 b00000000,
	 b00111100,
	 b01000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b01000000,
	 b00111100,
	 b00000000,
	 b00000000},	//	35	'C'

	{b00000000,
	 b00000000,
	 b11110000,
	 b10001000,
	 b10000100,
	 b10000100,
	 b10000100,
	 b10000100,
	 b10001000,
	 b11110000,
	 b00000000,
	 b00000000},	//	36	'D'

	{b00000000,
	 b00000000,
	 b11111000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b11111000,
	 b10000000,
	 b10000000,
	 b11111000,
	 b00000000,
	 b00000000},	//	37	'E'

	{b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b11111000,
	 b10000000,
	 b10000000,
	 b11111000,
	 b00000000,
	 b00000000},	//	38	'F'

	{b00000000,
	 b00000000,
	 b00111100,
	 b01000100,
	 b10000100,
	 b10011100,
	 b10000000,
	 b10000000,
	 b01000000,
	 b00111100,
	 b00000000,
	 b00000000},	//	39	'G'

	{b00000000,
	 b00000000,
	 b10000100,
	 b10000100,
	 b10000100,
	 b10000100,
	 b11111100,
	 b10000100,
	 b10000100,
	 b10000100,
	 b00000000,
	 b00000000},	//	40	'H'

	{b00000000,
	 b00000000,
	 b11100000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b11100000,
	 b00000000,
	 b00000000},	//	41	'I'

	{b00000000,
	 b00000000,
	 b11100000,
	 b00010000,
	 b00010000,
	 b00010000,
	 b00010000,
	 b00010000,
	 b00010000,
	 b01110000,
	 b00000000,
	 b00000000},	//	42	'J'

	{b00000000,
	 b00000000,
	 b10001000,
	 b10010000,
	 b10100000,
	 b11000000,
	 b11000000,
	 b10100000,
	 b10010000,
	 b10001000,
	 b00000000,
	 b00000000},	//	43	'K'

	{b00000000,
	 b00000000,
	 b11110000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000,
	 b00000000},	//	44	'L'

	{b00000000,
	 b00000000,
	 b10000010,
	 b10000010,
	 b10010010,
	 b10010010,
	 b10101010,
	 b10101010,
	 b11000110,
	 b11000110,
	 b00000000,
	 b00000000},	//	45	'M'

	{b00000000,
	 b00000000,
	 b10001100,
	 b10001100,
	 b10010100,
	 b10010100,
	 b10100100,
	 b10100100,
	 b11000100,
	 b11000100,
	 b00000000,
	 b00000000},	//	46	'N'

	{b00000000,
	 b00000000,
	 b00111000,
	 b01000100,
	 b10000010,
	 b10000010,
	 b10000010,
	 b10000010,
	 b01000100,
	 b00111000,
	 b00000000,
	 b00000000},	//	47	'O'

	{b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b11110000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b00000000,
	 b00000000},	//	48	'P'

	{b00110000,
	 b00001000,
	 b00111000,
	 b01000100,
	 b10000010,
	 b10000010,
	 b10000010,
	 b10000010,
	 b01000100,
	 b00111000,
	 b00000000,
	 b00000000},	//	49	'Q'

	{b00000000,
	 b00000000,
	 b10000100,
	 b10001000,
	 b10010000,
	 b11110000,
	 b10001000,
	 b10000100,
	 b10001000,
	 b11110000,
	 b00000000,
	 b00000000},	//	50	'R'

	{b00000000,
	 b00000000,
	 b11110000,
	 b00001000,
	 b00001000,
	 b00001000,
	 b01110000,
	 b10000000,
	 b10000000,
	 b01111000,
	 b00000000,
	 b00000000},	//	51	'S'

	{b00000000,
	 b00000000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b11111000,
	 b00000000,
	 b00000000},	//	52	'T'

	{b00000000,
	 b00000000,
	 b01111000,
	 b10000100,
	 b10000100,
	 b10000100,
	 b10000100,
	 b10000100,
	 b10000100,
	 b10000100,
	 b00000000,
	 b00000000},	//	53	'U'

	{b00000000,
	 b00000000,
	 b00100000,
	 b00100000,
	 b01010000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b00000000,
	 b00000000},	//	54	'V'

	{b00000000,
	 b00000000,
	 b01000100,
	 b01000100,
	 b01000100,
	 b10101010,
	 b10010010,
	 b10010010,
	 b10010010,
	 b10000010,
	 b00000000,
	 b00000000},	//	55	'W'

	{b00000000,
	 b00000000,
	 b10001000,
	 b10001000,
	 b01010000,
	 b00100000,
	 b00100000,
	 b01010000,
	 b10001000,
	 b10001000,
	 b00000000,
	 b00000000},	//	56	'X'

	{b00000000,
	 b00000000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b01010000,
	 b01010000,
	 b10001000,
	 b10001000,
	 b00000000,
	 b00000000},	//	57	'Y'

	{b00000000,
	 b00000000,
	 b11111000,
	 b10000000,
	 b01000000,
	 b00100000,
	 b00100000,
	 b00010000,
	 b00001000,
	 b11111000,
	 b00000000,
	 b00000000},	//	58	'Z'

	{b11100000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b11100000,
	 b00000000},	//	59	'['

	{b00000000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000},	//	60	'\'

	{b11100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b11100000,
	 b00000000},	//	61	']'

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b10000010,
	 b01000100,
	 b00101000,
	 b00010000,
	 b00000000,
	 b00000000},	//	62	'^'

	{b11111100,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	63	'_'

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00100000,
	 b01000000,
	 b00000000},	//	64	'`'

	{b00000000,
	 b00000000,
	 b01111000,
	 b10001000,
	 b10001000,
	 b01111000,
	 b00001000,
	 b01110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	65	'a'

	{b00000000,
	 b00000000,
	 b11110000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000},	//	66	'b'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b01110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	67	'c'

	{b00000000,
	 b00000000,
	 b01111000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b01111000,
	 b00001000,
	 b00001000,
	 b00001000,
	 b00000000},	//	68	'd'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10001000,
	 b10000000,
	 b11111000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	69	'e'

	{b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b11100000,
	 b10000000,
	 b10000000,
	 b01100000,
	 b00000000},	//	70	'f'

	{b01110000,
	 b00001000,
	 b01111000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	71	'g'

	{b00000000,
	 b00000000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000},	//	72	'h'

	{b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000,
	 b10000000,
	 b00000000,
	 b00000000},	//	73	'i'

	{b00000000,
	 b00000000,
	 b10000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b11000000,
	 b00000000,
	 b01000000,
	 b00000000,
	 b00000000},	//	74	'j'

	{b00000000,
	 b00000000,
	 b10001000,
	 b10010000,
	 b10100000,
	 b11000000,
	 b10100000,
	 b10010000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000},	//	75	'k'

	{b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b00000000},	//	76	'l'

	{b00000000,
	 b00000000,
	 b10010010,
	 b10010010,
	 b10010010,
	 b10010010,
	 b10010010,
	 b01101100,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	77	'm'

	{b00000000,
	 b00000000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	78	'n'

	{b00000000,
	 b00000000,
	 b01110000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b01110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	79	'o'

	{b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b11110000,
	 b10001000,
	 b10001000,
	 b11110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	80	'p'

	{b10000000,
	 b10000000,
	 b11111000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b01111000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	81	'q'

	{b00000000,
	 b00000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b11000000,
	 b10100000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	82	'r'

	{b00000000,
	 b00000000,
	 b11100000,
	 b00010000,
	 b00110000,
	 b11000000,
	 b10000000,
	 b01110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	83	's'

	{b00000000,
	 b00000000,
	 b01100000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b10000000,
	 b11100000,
	 b10000000,
	 b10000000,
	 b00000000,
	 b00000000},	//	84	't'

	{b00000000,
	 b00000000,
	 b01111000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b10001000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	85	'u'

	{b00000000,
	 b00000000,
	 b00100000,
	 b00100000,
	 b01010000,
	 b01010000,
	 b10001000,
	 b10001000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	86	'v'

	{b00000000,
	 b00000000,
	 b01000100,
	 b01000100,
	 b10101010,
	 b10101010,
	 b10010010,
	 b10010010,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	87	'w'

	{b00000000,
	 b00000000,
	 b10001000,
	 b01010000,
	 b00100000,
	 b00100000,
	 b01010000,
	 b10001000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	88	'x'

	{b01000000,
	 b01000000,
	 b00100000,
	 b00100000,
	 b01010000,
	 b01010000,
	 b10001000,
	 b10001000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	89	'y'

	{b00000000,
	 b00000000,
	 b11110000,
	 b10000000,
	 b01000000,
	 b00100000,
	 b00010000,
	 b11110000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	90	'z'

	{b00010000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b11000000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00100000,
	 b00010000,
	 b00000000},	//	91	'{'

	{b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b00000000},	//	92	'|'

	{b10000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b00110000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b01000000,
	 b10000000,
	 b00000000},	//	93	'}'

	{b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b10001100,
	 b10010010,
	 b01100010,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000,
	 b00000000},	//	94	'~'

	{b00000000,
	 b00000000,
	 b11111111,
	 b10000001,
	 b10000001,
	 b10000001,
	 b10000001,
	 b10000001,
	 b10000001,
	 b11111111,
	 b00000000,
	 b00000000}		//	95	''
};


//==========================================================================
//
//	The kerning values (how much space to remove between characters) of the
//	small font.
//
//==========================================================================

const int g_aKerningValues[96] =
{
	5, 4, 4, 0, 2,-1, 1, 6, 4, 4, 2, 0, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
	2, 2, 4, 4, 0, 0, 0, 3,-1, 1, 2, 1, 1, 2, 2, 1, 1, 4, 3, 2, 3, 0, 1, 0,
	2, 0, 1, 2, 2, 1, 2, 0, 2, 2, 2, 4, 4, 4, 0, 2,	4, 2, 2, 3, 2, 2, 4, 2,
	2, 6, 5, 3, 6, 0, 2, 2, 2, 2, 4, 3, 4, 2, 2, 0, 2, 2, 3, 3, 4, 3, 0, 0
};


//==========================================================================
//
//	This is the first of 96 display lists for each font character
//
//==========================================================================
unsigned int g_iFontStart=0;


//==========================================================================
//
//	Compile font into display lists
//
//==========================================================================
void FontInit()
{
   GLuint i, j;

   g_iFontStart = glGenLists(96);

   glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );

   for(i=0, j=' '; i<=96; i++, j++)
   {
      glNewList( g_iFontStart + j, GL_COMPILE );

      glBitmap(8, 12, 0.0, 0.0, 8-g_aKerningValues[i], 0.0, g_aFontCharacters[i]);
      glEndList();
   }
}

//==========================================================================
//
//	Print string to window using display lists that call glBitmap()
//
//==========================================================================
void FontDraw(char *txt, int x, int y)
{
	if(g_iFontStart == 0)
	{
		fprintf(stderr,"Error: font has not been initialised\n");
		return;
	}
	glPushAttrib(GL_LIST_BIT);
	glRasterPos2i(x, y);

	while( *txt != '\0' )
	{
		glCallList( (*txt) + g_iFontStart );
		++txt;
	}
	glPopAttrib();
}


//==========================================================================
//
//	Print string to window using display lists that call glBitmap()
//
//==========================================================================
void FontCleanup()
{
	if(g_iFontStart != 0)
		glDeleteLists(g_iFontStart,96);
	g_iFontStart = 0;
}


